package com.dome.gateway.route;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description:
 * @author: hz
 * @time: 2021/4/28 20:07
 */
@Configuration
@Slf4j
public class DynamicRouteConfiguration  {
    @Autowired
    private ZuulProperties zuulProperties;
    @Autowired
    private ServerProperties server;
    @Autowired
    private GatewayApiRouteProperties gatewayApiRouteProperties;



    @Bean
    public DynamicRouteLocator routeLocator() {
        DynamicRouteLocator routeLocator = new DynamicRouteLocator(
                this.server.getServlet().getContextPath(), this.zuulProperties,this.gatewayApiRouteProperties);
        return routeLocator;
    }
    //${spring.application.name}-${spring.cloud.nacos.config.prefix}.${spring.cloud.nacos.config.file-extension}

}